package cn.source.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.source.common.annotation.Log;
import cn.source.common.core.controller.BaseController;
import cn.source.common.core.domain.AjaxResult;
import cn.source.common.enums.BusinessType;
import cn.source.system.domain.GkCardManage;
import cn.source.system.service.IGkCardManageService;
import cn.source.common.utils.poi.ExcelUtil;
import cn.source.common.core.page.TableDataInfo;

/**
 * 发卡人员管理Controller
 *
 * @author sourcebyte.vip
 * @date 2025-04-29
 */
@RestController
@RequestMapping("/system/gkCardManage")
public class GkCardManageController extends BaseController
{
    @Autowired
    private IGkCardManageService gkCardManageService;

    /**
     * 查询发卡人员管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:gkCardManage:list')")
    @GetMapping("/list")
    public TableDataInfo list(GkCardManage gkCardManage)
    {
        startPage();
        List<GkCardManage> list = gkCardManageService.selectGkCardManageList(gkCardManage);
        return getDataTable(list);
    }

    /**
     * 获取发卡人员管理详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gkCardManageService.selectGkCardManageById(id));
    }

    /**
     * 新增发卡人员管理
     */
    @PreAuthorize("@ss.hasPermi('system:gkCardManage:add')")
    @Log(title = "发卡人员管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GkCardManage gkCardManage)
    {
        return toAjax(gkCardManageService.insertGkCardManage(gkCardManage));
    }

    /**
     * 修改发卡人员管理
     */
    @PreAuthorize("@ss.hasPermi('system:gkCardManage:edit')")
    @Log(title = "发卡人员管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GkCardManage gkCardManage)
    {
        return toAjax(gkCardManageService.updateGkCardManage(gkCardManage));
    }

    /**
     * 删除发卡人员管理
     */
    @PreAuthorize("@ss.hasPermi('system:gkCardManage:remove')")
    @Log(title = "发卡人员管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gkCardManageService.deleteGkCardManageByIds(ids));
    }

    /**
     * 导出发卡人员管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:gkCardManage:export')")
    @Log(title = "发卡人员管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GkCardManage gkCardManage)
    {
        List<GkCardManage> list = gkCardManageService.selectGkCardManageList(gkCardManage);
        ExcelUtil<GkCardManage> util = new ExcelUtil<GkCardManage>(GkCardManage.class);
        util.exportExcel(response, list, "发卡人员管理数据");
    }
}
